"use strict";
cc._RF.push(module, '832b3vitR1J3432iMfoK8i+', 'TipLine');
// scripts/TipLine.ts

Object.defineProperty(exports, "__esModule", { value: true });
var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
var TipLine = /** @class */ (function (_super) {
    __extends(TipLine, _super);
    function TipLine() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    TipLine.prototype.onLoad = function () {
        this.draw = this.node.getComponent(cc.Graphics);
    };
    Object.defineProperty(TipLine.prototype, "points", {
        get: function () {
            return this._points;
        },
        set: function (v) {
            this._points = v;
            this.draw.clear();
            this.draw.moveTo(v[0].x, v[0].y);
            for (var i = 1; i < v.length; i++) {
                var startPos = v[i - 1];
                var endPos = v[i];
                var line = endPos.sub(startPos);
                var lineLenth = line.mag();
                var unitLenth = 10;
                var increment = line.normalize().mul(unitLenth);
                var pos = startPos.clone();
                var drawLine = true;
                for (; lineLenth > unitLenth; lineLenth -= unitLenth) {
                    if (drawLine) {
                        this.draw.moveTo(pos.x, pos.y);
                        pos.addSelf(increment);
                        this.draw.lineTo(pos.x, pos.y);
                        this.draw.stroke();
                    }
                    else {
                        pos.addSelf(increment);
                    }
                    drawLine = !drawLine;
                }
                if (drawLine) {
                    this.draw.moveTo(pos.x, pos.y);
                    this.draw.lineTo(endPos.x, endPos.y);
                    this.draw.stroke();
                }
            }
            this.draw.stroke();
        },
        enumerable: false,
        configurable: true
    });
    TipLine = __decorate([
        ccclass
    ], TipLine);
    return TipLine;
}(cc.Component));
exports.default = TipLine;

cc._RF.pop();